<!doctype html>
<meta charset="utf-8">
<script>
	window.onload=function(){
		
		var oTab=document.getElementById('tab1');
		var oBtn=document.getElementById('btn');
		var oTxt=document.getElementById('nam');

		oBtn.onclick=function(){
			for(var i=0;i<oTab.tBodies[0].rows.length;i++)
			{
				if(oTab.tBodies[0].rows[i].cells[1].innerHTML==oTxt.value)
				{
					oTab.tBodies[0].rows[i].style.background='red';
				}
				else
				{
					oTab.tBodies[0].rows[i].style.background='';
				}
			}	
		};
};
</script>
搜索：<input id="nam" type="text">
<input type="button" id="btn" value="搜索">
<table id="tab1" border="1" width="500">
	<thead>
		<td>ID</td>
		<td>姓名</td>
		<td>年龄</td>
        <td>操作</td>
	</thead>
	<tbody>
		<tr> 
			<td>1</td>
			<td>Blue</td>
			<td>78</td>
            <td></td>
		</tr>
		<tr>
			<td>2</td>
			<td>Black</td>
			<td>56</td>
            <td></td>
		</tr>
		<tr>
			<td>3</td>
			<td>张三</td>
			<td>12</td>
            <td></td>
		</tr>
		<tr>
			<td>4</td>
			<td>李四</td>
			<td>45</td>
            <td></td>
		</tr>
		<tr>
			<td>5</td>
			<td>王五</td>
			<td>23</td>
            <td></td>
		</tr>
		<tr>
			<td>6</td>
			<td>老三</td>
			<td>43</td>
            <td></td>
		</tr>
	</tbody>
</table>